Obtener el error anterior al intentar autenticar a un nuevo usuario mediante oAuth 2.0 de LinkedIn. Parece que me están pasando un ObjectId de 10 dígitos en lugar de una identificación de 12 o 24 caracteres...
passport.use(new LinkedInStrategy({ clientID: process.env.LI_ID, clientSecret: process.env.LI_SECRET, callbackURL: "http://localhost:3000/auth/linkedin/think-it", scope: ['r_emailaddress', 'r_liteprofile'], state: true }, function(accessToken, refreshToken, profile, done) { // asynchronous verification, for effect... process.nextTick(function () { // To keep the example simple, the user's LinkedIn profile is returned to // represent the logged-in user. In a typical application, you would want // to associate the LinkedIn account with a user record in your database, // and return that user instead. return done(null, profile); }); }));Me estoy quedando colgado en:
passport.deserializeUser(function(id, done) { User.findById(id, function(err, user) { done(err, user); }); });Resuelto. No estaba devolviendo a un usuario de mi base de datos. Del código de arriba:
...function(accessToken, refreshToken, profile, done) { // asynchronous verification, for effect... process.nextTick(function () { //code below was not present when I was getting the error: User.findOrCreate({ linkedInId: profile.id}, function(err, user) { if (err) { return done(err); } done(null, user); }); });